home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / falcon / nt_dsp2.lzh / NT_DSP2.MSA / BENCH / C-96 < prev    next >
Encoding:
Text File  |  1988-08-24  |  9.1 KB  |  225 lines

  1.     page 132,60,1,1
  2. ;*******************************************
  3. ;Motorola Austin DSP Operation  June 30,1988
  4. ;*******************************************
  5. ;DSP960002
  6. ;Memory to Memory FFT - 1024 point
  7. ;File name: C-96.asm
  8. ;**************************************************************************
  9. ;    Maximum sample rate:  1.551 ms at 27.0 MHz
  10. ;    Memory Size: Prog:  137 words ; Data:  5120 words
  11. ;    Number of clock cycles:    41868 (20934 instruction cycles)
  12. ;    Clock Frequency:    27.0MHz
  13. ;    Instruction cycle time:    74.1ns
  14. ;**************************************************************************
  15. ;
  16. ; Complex, Radix 2 Cooley-Tukey Decimation in Time FFT
  17. ; Untested
  18. ;
  19. ; Faster FFT using Programming Tricks found in Typical FORTRAN Libraries
  20. ;
  21. ;      First two passes combined as a four butterfly loop since
  22. ;            multiplies are trivial.
  23. ;            2.25 cycles internal (4 cycles external) per Radix 2 
  24. ;            butterfly.
  25. ;      Middle passes performed with traditional, triple-nested DO loop.
  26. ;            4 cycles internal (8 cycles external) per Radix 2 butterfly
  27. ;            plus overhead.  Note that a new pipelining technique is 
  28. ;            being used to minimize overhead.
  29. ;      Next to last pass performed with double butterfly loop.
  30. ;            4.5 cycles internal (8.5 cycles external) per Radix 2
  31. ;            butterfly.
  32. ;      Last pass has separate single butterfly loop.
  33. ;            5 cycles internal (9 cycles external) per Radix 2 
  34. ;            butterfly.
  35. ;
  36. ;      For 1024 complex points, average Radix 2 butterfly = 3.8 cycles
  37. ;      internal and 7.35 cycles external, assuming a single external
  38. ;      data bus.
  39. ;
  40. ;      Because of separate passes, minimum of 32 points using these
  41. ;      optimizations.  Approximately 150 program words required. 
  42. ;      Uses internal X and Y Data ROMs for twiddle factor coefficients
  43. ;      for any size FFT up to 1024 complex points.
  44. ;
  45. ;      Assuming internal program and internal data memory (or two
  46. ;      external data buses, 1024 point complex FFT is 1.57 msec at 
  47. ;      75 nsec instruction rate.  Assuming internal program and 
  48. ;      external data memory, 1024 point complex FFT is 2.94 msec 
  49. ;      at 75 nsec instruction rate.
  50. ;
  51. ; First two passes
  52. ;
  53. ;      9 cycles internal, 1.77X faster than 4 cycle Radix 2 bfy
  54. ;      16 cycles external, 2.0X faster than 4 cycle Radix 2 bfy
  55. ;
  56. ;      r0 = a pointer in & out
  57. ;      r6 = a pointer in
  58. ;      r4 = b pointer in & out
  59. ;      r1 = c pointer in & out
  60. ;      r5 = d pointer in & out
  61. ;      n5 = 2
  62. ;
  63. ;      normally ordered input data
  64. ;      normally ordered output data
  65. ;
  66.       move      #points,d1.l
  67.       move      #passes,d9.l
  68.       move      #data,d0.l
  69.       move      #coef,m2
  70.       move      #coefsize,d2.l
  71.  
  72.       lsr      d1         d0.l,r0
  73.       lsr      d1         r0,r2
  74.       add      d1,d0      d1.l,d8.l
  75.       add      d1,d0      d0.l,r4
  76.       add      d1,d0      d0.l,r1
  77.       lsr      d2         d0.l,r5
  78.       lsr      d2         r0,r6
  79.       move      #2,n5
  80.       move      d2.l,n6
  81.       move      #-1,m0
  82.       move      m0,m1
  83.       move      m0,m4
  84.       move      m0,m5
  85.       move      m0,m6
  86.  
  87.       fmove                             x:(r0),d1.s
  88.       fmove                             x:(r1),d0.s             
  89.       fmove                             x:(r5)-,d2.s            
  90.       fmove                                          y:(r5)+,d4.s
  91.       faddsub  d1,d0                    x:(r4),d5.s               
  92.       faddsub  d5,d2                                 y:(r4),d7.s  
  93. ;
  94. ;      Combine first two passes with trivial multiplies.
  95. ;
  96.       do      d8.l,_twopass
  97.  
  98.       faddsubr d0,d2                                   y:(r5),d6.s  
  99.       faddsub  d7,d6                     d2.s,x:(r0)+  y:(r6)+,d3.s 
  100.       faddsubr d1,d7                     d0.s,x:(r4)   y:(r1)+,d2.s 
  101.       faddsub  d3,d2                     d1.s,x:(r5)-             
  102.       faddsubr d2,d6                     x:(r0)-,d1.s  d4.s,y:(r5)+n5
  103.       faddsubr d3,d5                     x:(r1)-,d0.s  d2.s,y:(r4)+  
  104.       faddsub  d1,d0                     x:(r5),d2.s   d6.s,y:(r0)+  
  105.       ftfr     d5,d4                     x:(r4),d5.s   d3.s,y:(r1)   
  106.       faddsub  d5,d2                     d7.s,x:(r1)+  y:(r4),d7.s    
  107. _twopass
  108.       fmove                                            d4.s,y:(r5)+   
  109. ;
  110. ; Middle passes
  111. ;
  112.       tfr      d9,d3      #4,d0.l
  113.       clr      d2         d8.l,d1.l
  114.       sub      d0,d3      d2.l,m6
  115.       do      d3.l,_end_pass
  116.       move    d0.l,n2
  117.       move    r2,r0
  118.       lsr     d1      m2,r6
  119.       dec     d1      d1.l,n0
  120.       dec     d1      d1.l,n1
  121.       move    d1.l,n3
  122.       move    n0,n4
  123.       move    n0,n5
  124.       lea     (r0)+n0,r1
  125.       move    r0,r4
  126.       move    r1,r5
  127.       fmove                             x:(r6)+n6,d9.s y:(),d8.s
  128.       fmove                                            y:(r1),d7.s
  129.       fmpy    d8,d7,d3                  x:(r1)+,d6.s
  130.       fmpy    d9,d6,d0
  131.       fmpy    d9,d7,d1                                 y:(r1),d7.s
  132.       fmpy    d8,d6,d2  fadd     d3,d0  x:(r0),d4.s
  133.       fmpy    d8,d7,d3  faddsubr d4,d0  x:(r1)+,d6.s
  134.  
  135.       do      n2,_end_grp
  136.  
  137.       do      n3,_end_bfy
  138.       fmpy    d9,d6,d0  fsub     d1,d2  d0.s,x:(r4)    y:(r0)+,d5.s
  139.       fmpy    d9,d7,d1  faddsubr d5,d2  d4.s,x:(r5)    y:(r1),d7.s
  140.       fmpy    d8,d6,d2  fadd     d3,d0  x:(r0),d4.s    d2.s,y:(r5)+
  141.       fmpy    d8,d7,d3  faddsubr d4,d0  x:(r1)+,d6.s   d5.s,y:(r4)+
  142. _end_bfy
  143.       move      (r1)+n1
  144.       fmpy    d9,d6,d0  fsub     d1,d2  d0.s,x:(r4)    y:(r0)+,d5.s
  145.       fmpy    d9,d7,d1  faddsubr d5,d2  d4.s,x:(r5)    y:(r1),d7.s
  146.       fmpy    d8,d6,d2  fadd     d3,d0  x:(r0),d4.s    d2.s,y:(r5)+
  147.       fmove                             x:(r6)+n6,d9.s y:(),d8.s
  148.       fmpy    d8,d7,d3  faddsubr d4,d0  x:(r1)+,d6.s   d5.s,y:(r4)+
  149.       fmpy    d9,d6,d0  fsub     d1,d2  d0.s,x:(r4)    y:(r0)+n0,d5.s
  150.       fmpy    d9,d7,d1  faddsubr d5,d2  d4.s,x:(r5)    y:(r1),d7.s
  151.       fmpy    d8,d6,d2  fadd     d3,d0  x:(r0),d4.s    d2.s,y:(r5)+n5
  152.       fmpy    d8,d7,d3  faddsubr d4,d0  x:(r1)+,d6.s   d5.s,y:(r4)+n4
  153. _end_grp
  154.       move     n2,d0.l
  155.       lsl      d0      n0,d1.l
  156. _end_pass
  157. ;
  158. ; next to last pass
  159. ;
  160.       move      d0.l,n2
  161.       move      r2,r0
  162.       move      r0,r4
  163.       lea      (r0)+2,r1
  164.       move      r1,r5
  165.       move      m2,r6
  166.       move      #3,n0
  167.       move      n0,n1
  168.       move      n0,n4
  169.       move      n0,n5
  170.       fmove                             x:(r6)+n6,d9.s  y:(),d8.s
  171.       fmove                                             y:(r1),d7.s
  172.       fmpy    d8,d7,d3                  x:(r1)+,d6.s
  173.       fmpy    d9,d6,d0
  174.       fmpy    d9,d7,d1                                  y:(r1),d7.s
  175.       fmpy    d8,d6,d2  fadd     d3,d0  x:(r0),d4.s
  176.       fmpy    d8,d7,d3  faddsubr d4,d0  x:(r1)+n1,d6.s
  177.  
  178.       do      n2,_end_next
  179.       fmpy    d9,d6,d0  fsub     d1,d2  d0.s,x:(r4)     y:(r0)+,d5.s
  180.       fmpy    d9,d7,d1  faddsubr d5,d2  d4.s,x:(r5)     y:(r1),d7.s
  181.       fmpy    d8,d6,d2  fadd     d3,d0  x:(r0),d4.s     d2.s,y:(r5)+
  182.       fmove                             x:(r6)+n6,d9.s  y:(),d8.s
  183.       fmpy    d8,d7,d3  faddsubr d4,d0  x:(r1)+,d6.s    d5.s,y:(r4)+
  184.       fmpy    d9,d6,d0  fsub     d1,d2  d0.s,x:(r4)     y:(r0)+n0,d5.s
  185.       fmpy    d9,d7,d1  faddsubr d5,d2  d4.s,x:(r5)     y:(r1),d7.s
  186.       fmpy    d8,d6,d2  fadd     d3,d0  x:(r0),d4.s     d2.s,y:(r5)+n5
  187.       fmpy    d8,d7,d3  faddsubr d4,d0  x:(r1)+n1,d6.s  d5.s,y:(r4)+n4
  188. _end_next
  189. ;
  190. ; last pass
  191. ;
  192.       move      n2,d0.l        ;# previous groups ->d0
  193.       lsl       d0      r2,r0    ;update # groups, r0 points to input data A
  194.       move      d0.l,n2        ;# stages ->n2
  195.       move      #odata,r4    ;r4 points to A output
  196.       lea      (r0)+,r1         ;r1 points to B input
  197.       move      r4,r2        ;r2 points to A output                 
  198.       move      m2,r6           ;r6 points to twiddle factors  
  199.       move      #2,n0        ;offset is 2 for A input pointer
  200.       move      n0,n1        ;offset is 2 for B input pointer
  201.       lea    (r2)+n2,r5    ;r5 points to B output
  202.       move     #points/4,n4    ;offset is #points/4 for A output pointer
  203.       move      n4,n5        ;offset is #points/4 for B output pointer
  204.       move     #0,m4        ;bit reversed addressing for A output pointer
  205.       move     m4,m5        ;bit reversed addressing for B output pointer
  206.  
  207.       fmove                             x:(r6)+n6,d9.s  y:(),d8.s
  208.       fmove                                             y:(r1),d7.s
  209.       fmpy    d8,d7,d3                  x:(r1)+n1,d6.s
  210.       fmpy    d9,d6,d0
  211.       fmpy    d9,d7,d1                                  y:(r1),d7.s
  212.       fmpy    d8,d6,d2  fadd     d3,d0  x:(r0),d4.s
  213.       fmove                             x:(r6)+n6,d9.s  y:(),d8.s
  214.       fmpy    d8,d7,d3  faddsubr d4,d0  x:(r1)+n1,d6.s
  215.  
  216.       do      n2,_end_last
  217.       fmpy    d9,d6,d0  fsub     d1,d2  d0.s,x:(r4)     y:(r0)+n0,d5.s
  218.       fmpy    d9,d7,d1  faddsubr d5,d2  d4.s,x:(r5)     y:(r1),d7.s
  219.       fmpy    d8,d6,d2  fadd     d3,d0  x:(r0),d4.s     d2.s,y:(r5)+n5
  220.       fmove                             x:(r6)+n6,d9.s  y:(),d8.s
  221.       fmpy    d8,d7,d3  faddsubr d4,d0  x:(r1)+n1,d6.s  d5.s,y:(r4)+n4
  222. _end_last
  223.  
  224.  
  225.